package com.luoc.spring.AOP;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

/**
 * @author luoc
 * @version 1.0
 * @date 2021/3/19 10:01
 * @since 1.0
 */
@Aspect
public class AspectTest {

    @Pointcut("execution(* com.luoc.spring.AOP..test(..))")
    public void test(){

    }

    @Before("test()")
    public void beforeTest(){
        System.out.println("before Test");
    }

    @After("test()")
    public void afterTest(){
        System.out.println("after Test");
    }

    @Around("test()")
    public Object around(ProceedingJoinPoint p){
        System.out.println("before1");

        Object a = null;
        try {
             a =  p.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        System.out.println("after1");
        return a;
    }

}
